package controllers.common;

import common.log.RequestLogger;

import play.Play;
import play.mvc.After;
import play.mvc.Before;
import play.mvc.Controller;

public class Ceng433BaseController extends Controller {
  @Before
  public static void initializeRequest() {
    RequestLogger rl = getRequestLogger();
  }
  
  @After
  public static void finalizeRequest() {
    RequestLogger rl = getRequestLogger();
    rl.finalizeRequest();
  }
  
  protected static RequestLogger getRequestLogger() {
    RequestLogger rl = (RequestLogger)request.args.get("req.log");
    if (rl == null) {
      rl = new RequestLogger(request, session);
      request.args.put("uym.req.log", rl);
    }
    return rl;
  }
}
